package com.systop.busafter.driver.mapper;

import com.systop.commer.pojo.Driver;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DriverMapper {
    /*
     * 修改driver
     * driver driver
     * return int
     * csh
     *
     * */
    @Update("update driver set driver_name_n = #{driver_name_n},driver_password = #{driver_password},driver_remarks = #{driver_remarks}," +
            "driver_name = #{driver_name},driver_card_personal = #{driver_card_personal},driver_card = #{driver_card}," +
            "driver_personal = #{driver_personal},driver_certificate = #{driver_certificate},driver_fraction = #{driver_fraction}," +
            "driver_state = #{driver_state},driver_number = #{driver_number},driver_deposit = #{driver_deposit},driver_s = #{driver_s} where driver_id = #{driver_id}")
    int updatadriver(Driver driver);


    //"time = #{time,jdbcType=TIMESTAMP} "  时间类型

    /*
     * 添加driver
     * driver driver
     * return int
     * csh
     *
     * */
    @Insert("insert into driver(driver_name_n,driver_password,driver_remarks,driver_name,driver_card_personal,driver_card,driver_personal,driver_certificate,driver_fraction,driver_state,driver_number,driver_deposit,driver_s) values " +
            "(#{driver_name_n},#{driver_password},#{driver_remarks},#{driver_name},#{driver_card_personal},#{driver_card},#{driver_personal},#{driver_certificate},#{driver_fraction}," +
            "#{driver_state},#{driver_number},#{driver_deposit},#{driver_s})")
    int insertdriver(Driver driver);

    /*
     * 登陆(账号密码)
     * driver driver
     * driver driver
     * csh
     * */
    @Select("select * from driver where driver_name_n = #{driver_name_n} and driver_password= #{driver_password}")
    Driver driverLogin(Driver driver);

    /*
     * 登陆(手机密码)(有点问题没有测试)
     * driver driver
     * driver driver
     * csh
     * */
    @Select("select * from driver where driver_number = #{driver_number} and driver_password= #{driver_password}")
    Driver numdriverLogin(Driver driver);
    /*
     * 查看全部
     * 无
     * list
     * csh
     * */
    @Select("select * from driver")
    List<Driver> driverListall();

    /*
     * 用id查看driver
     * driver_id  int
     * list
     * csh
     * */
    @Select("select * from driver where driver_id = #{driver_id}")
    List<Driver> driverIdlist(int driver_id);

    /*
     * 删除driver
     * driver_id  int
     * return int
     * csh
     * */
    @Delete("delete from driver where driver_id=#{driver_id}")
    int deletedriver(int driver_id);
    /*
     * 用分数查看driver
     * driver_fraction  int
     * list
     * csh
     * */
    @Select("select * from driver where driver_fraction >= #{driver_fraction}")
    List<Driver> driverFractionlist(int driver_fraction);
    /*
     * 用状态查看driver
     * driver_state  int
     * list
     * csh
     * */
    @Select("select * from driver where driver_state = #{driver_state}")
    List<Driver> driverStatelist(int driver_state);
    /*
     * 用押金状态查看driver
     * driver_state  int
     * list
     * csh
     * */
    @Select("select * from driver where driver_deposit = #{driver_deposit}")
    List<Driver> driverDepositlist(float driver_deposit);
    /*
     * 用名字查看driver
     * driver_state  int
     * list
     * csh
     * */
    @Select("select * from driver where driver_name = #{driver_name}")
    List<Driver> driverNamelist(String driver_name);

    @Select("select * from driver where driver_name_n = #{driver_name_n}")
     Driver drivername1(String driver_name_n);


    @Select("select * from driver where driver_name_n = #{driver_name_n}")
    List<Driver> drivername(String driver_name_n);

    @Select("select * from driver where driver_card = #{driver_card}")
    List<Driver> drivercard(String driver_card);

}
